#========================================
#    author: Changlong.Zang
#      mail: zclongpop123@163.com
#      time: Sun Oct 18 13:50:21 2020
#========================================
import os, glob, json
import n_env
#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
def get_asset_shader_file(_asset_type, _asset):
    '''
    '''
    shader_files = glob.glob(n_env.ASSET_SHADER_PATH_PATTRN.format(asset_type=_asset_type, asset=_asset))
    if not shader_files:
        return str()

    else:
        return shader_files[-1]




def get_shot_info(_seq, _shot):
    '''
    '''
    info_files = glob.glob(n_env.SHOT_INFO_PATH_PATTRN.format(seq=_seq, shot=_shot, step='ani', task='animation'))
    if not info_files:
        return dict()

    else:
        with open(info_files[-1], 'r') as f:
            return json.load(f)




def get_ani_cache_list(_seq, _shot):
    '''
    '''
    shot_version_list = glob.glob(n_env.SHOT_ROOT_PATH_PATTRN.format(seq=_seq, shot=_shot, step='ani', task='animation'))
    if not shot_version_list:
        return list()

    else:
        return glob.glob(os.path.join(shot_version_list[-1], '*.abc'))




if __name__ == '__main__':
    print get_ani_cache_list('b10', 'sc040')
